<template>
  <view>
    <view class="status_bar">
        <!-- 这里是状态栏 -->
    </view>
    <view class="top-nav" :style="{height: navHeight,lineHeight:navHeight}">
      {{title}}
    </view>
  </view>
</template>

<script>
  export default {
    name:"top-nav",
    props: {
        title:{
          type:String,
          default:function(){
            return '首页'
          }
        }
    },
    data() {
      return {
        navHeight:0
      };
    },
      
    mounted() {
      var demo = uni.getMenuButtonBoundingClientRect()
      this.navHeight = demo.height + 'px'
    },
  }
</script>

<style lang="scss">
  .status_bar {
      height: var(--status-bar-height);
      width: 100%;
  }
  .top-nav {
    text-align: center;
  }
</style>